package cn.shiro.shiroservice.auth.provider.filter;

import cn.shiro.shiroservice.common.constant.HttpRequestManaPoint;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;

/**
 * &#064;Time 2024 二月 星期四 11:26
 *
 * @author ShangGuan
 */
@Data
@Component
public class SimpleLoginFilter {


    private static String prefix = HttpRequestManaPoint.HTTP_PREFIX;

    @Value("${shiro.loginUrl}")
    private String authLoginPath ;


    /**
     * 断言路径
     * 如果路径 符合要求就返回true 否值返回false
     * @param request 要求
     * @return boolean
     */

    public boolean assertPath(HttpServletRequest request){
        String pathInfo = request.getRequestURI();
        if((prefix+authLoginPath).equals(pathInfo)){
            return true;
        }
        return false;
    }
}
